var exec = require('child_process').execSync;

// +-----------------------------------------------------------------------
// |                        获取Git更新
// +-----------------------------------------------------------------------
function pull( path ) {
    var cmdStr;
    try {
        cmdStr = exec( "cd " + path + " && " + "git pull", { encoding: 'utf8' } );
    } catch ( err ) {
        console.log( err );
        return false;
    }
    
    if( cmdStr.indexOf( "changed" ) != -1 ) return true;
    else if( cmdStr.indexOf( "Already up-to-date." ) != -1 ) return false;
}

exports.pull = pull;
// console.log( pull( "/Projects/node/develop-tools" ) );